Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Expand TriggerTrigger
Collapse CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Fetch Firehose

 
      DECLARE myCursor CURSOR
      LOCAL
      FAST_FORWARD
      FOR SELECT Name FROM EMP

      DECLARE   @Name   char(10)
      DECLARE   @i      tinyint

      OPEN myCursor

      SET   @i = 0
      WHILE @i < 5
      BEGIN
        FETCH myCursor
        INTO @Name
        SET @i = @i + 1
        SELECT  'No.' + STR(@i)+' Person is '+ @Name
      END

      CLOSE myCursor

      DEALLOCATE myCursor